package com.google.code.sip.ucenter.security;

import org.jasig.cas.authentication.handler.AuthenticationException;
import org.jasig.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler;
import org.jasig.cas.authentication.principal.UsernamePasswordCredentials;

import com.google.code.sip.ucenter.service.UserManager;

public class CustomerAuthenticationHandler extends
		AbstractUsernamePasswordAuthenticationHandler {
	private UserManager userManager;

	@Override
	protected boolean authenticateUsernamePasswordInternal(
			UsernamePasswordCredentials credentials)
			throws AuthenticationException {
		String username = credentials.getUsername();
		String password = credentials.getPassword();
		return userManager.login(username, password);
	}

	public void setUserManager(UserManager userService) {
		this.userManager = userService;
	}
}
